package com.joplus.housekeeper.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/8/15.
 */
public class Interest implements Parcelable,Serializable, Cloneable {


    /**
     * interestId : in1470980645764dHda
     * interestName : 美食餐饮
     * sonInterestList : [{"id":10,"parentId":"in1470980645764dHda","interestId":"in1","interestName":"吃1","createTime":1470987381000,"updateTime":1470987378000,"status":"0"},{"id":11,"parentId":"in1470980645764dHda","interestId":"insert2","interestName":"吃2","createTime":1470987389000,"updateTime":1470987403000,"status":"0"},{"id":12,"parentId":"in1470980645764dHda","interestId":"insert3","interestName":"吃3","createTime":1470987395000,"updateTime":1470987405000,"status":"0"}]
     * status : 0
     */

    private String interestId;
    private String interestName;
    private String status;
    private String icon;

    public String getIco() {
        return icon;
    }

    public void setIco(String ico) {
        this.icon = ico;
    }

    @Override
    public String toString() {
        return "Interest{" +
                "interestId='" + interestId + '\'' +
                ", interestName='" + interestName + '\'' +
                ", status='" + status + '\'' +
                ", ico='" + icon + '\'' +
                ", sonInterestList=" + sonInterestList +
                '}';
    }

    /**
     * id : 10
     * parentId : in1470980645764dHda
     * interestId : in1
     * interestName : 吃1
     * createTime : 1470987381000
     * updateTime : 1470987378000
     * status : 0
     */

    private List<SonInterestListBean> sonInterestList;


    @Override
    public Interest clone() {

        Interest interest = new Interest();
        interest.setStatus(this.status);
        interest.setSonInterestList(this.sonInterestList);
        interest.setInterestName(this.interestName);
        interest.setInterestId(this.interestId);
        return interest;
    }

    public String getInterestId() {
        return interestId;
    }

    public void setInterestId(String interestId) {
        this.interestId = interestId;
    }

    public String getInterestName() {
        return interestName;
    }

    public void setInterestName(String interestName) {
        this.interestName = interestName;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<SonInterestListBean> getSonInterestList() {
        return sonInterestList;
    }

    public void setSonInterestList(List<SonInterestListBean> sonInterestList) {
        this.sonInterestList = sonInterestList;
    }

    public static class SonInterestListBean implements Parcelable, Cloneable {
        private String id;
        private String parentId;
        private String interestId;
        private String interestName;
        private String createTime;
        private String updateTime;
        private String status;


        @Override
        public boolean equals(Object o) {
            return  this.getInterestId().equals(((SonInterestListBean)o).getInterestId());

        }

        @Override
        public String toString() {
            return "SonInterestListBean{" +
                    "id='" + id + '\'' +
                    ", parentId='" + parentId + '\'' +
                    ", interestId='" + interestId + '\'' +
                    ", interestName='" + interestName + '\'' +
                    ", createTime='" + createTime + '\'' +
                    ", updateTime='" + updateTime + '\'' +
                    ", status='" + status + '\'' +
                    '}';
        }

        @Override
        public SonInterestListBean clone() {
            SonInterestListBean sonInterestListBean = new SonInterestListBean();
            sonInterestListBean.setInterestId(this.interestId);
            sonInterestListBean.setInterestName(this.interestName);
            sonInterestListBean.setStatus(this.status);
            sonInterestListBean.setId(this.id);

            return sonInterestListBean;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getParentId() {
            return parentId;
        }

        public void setParentId(String parentId) {
            this.parentId = parentId;
        }

        public String getInterestId() {
            return interestId;
        }

        public void setInterestId(String interestId) {
            this.interestId = interestId;
        }

        public String getInterestName() {
            return interestName;
        }

        public void setInterestName(String interestName) {
            this.interestName = interestName;
        }

        public String getCreateTime() {
            return createTime;
        }

        public void setCreateTime(String createTime) {
            this.createTime = createTime;
        }

        public String getUpdateTime() {
            return updateTime;
        }

        public void setUpdateTime(String updateTime) {
            this.updateTime = updateTime;
        }

        public String getStatus() {
            return status;
        }

        public void setStatus(String status) {
            this.status = status;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.parentId);
            dest.writeString(this.interestId);
            dest.writeString(this.interestName);
            dest.writeString(this.createTime);
            dest.writeString(this.updateTime);
            dest.writeString(this.status);
        }

        public SonInterestListBean() {
        }

        protected SonInterestListBean(Parcel in) {
            this.id = in.readString();
            this.parentId = in.readString();
            this.interestId = in.readString();
            this.interestName = in.readString();
            this.createTime = in.readString();
            this.updateTime = in.readString();
            this.status = in.readString();
        }

        public static final Creator<SonInterestListBean> CREATOR = new Creator<SonInterestListBean>() {
            @Override
            public SonInterestListBean createFromParcel(Parcel source) {
                return new SonInterestListBean(source);
            }

            @Override
            public SonInterestListBean[] newArray(int size) {
                return new SonInterestListBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.interestId);
        dest.writeString(this.interestName);
        dest.writeString(this.status);
        dest.writeList(this.sonInterestList);
    }

    public Interest() {
    }

    protected Interest(Parcel in) {
        this.interestId = in.readString();
        this.interestName = in.readString();
        this.status = in.readString();
        this.sonInterestList = new ArrayList<SonInterestListBean>();
        in.readList(this.sonInterestList, SonInterestListBean.class.getClassLoader());
    }

    public static final Creator<Interest> CREATOR = new Creator<Interest>() {
        @Override
        public Interest createFromParcel(Parcel source) {
            return new Interest(source);
        }

        @Override
        public Interest[] newArray(int size) {
            return new Interest[size];
        }
    };
}
